package com.neusoft.mms.dao;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.neusoft.mms.bean.User;
import com.neusoft.mms.bean.UserVo;



public class UserDaoImpl extends HibernateDaoSupport implements UserDao {

	public UserVo getUserByName(String username) {
		UserVo user = null;
		List<User> userlist = getHibernateTemplate().find("from User u where username like ?", "%"+username+"%");
		if(userlist!=null&&userlist.size()>0){
		User u = userlist.get(0);
		user = new UserVo();
		user.setId(u.getId());
		user.setUsername(u.getUsername());
		user.setSex(u.getSex());
		user.setPassword(u.getPassword());
		user.setPermission(u.getPermission());
		user.setNickname(u.getNickname());
		user.setEmail(u.getEmail());
		}
		return user;
	}

}
